package com.example.springmvcinterview.configTest;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;

/**
 * @Author : 叶荻风
 * @create : 2024/12/16 15:56
 */
@Component("aaa")

public class Myservice implements InitializingBean {
    @Resource
    AppConfig appConfig;

    @Autowired
    AppConfig appConfig1;

    public void doSomething() {

        System.out.println("Doing something..." + appConfig.getClass()+appConfig1.getClass());
    }

    public Myservice() {
        System.out.println("Myservice create");
    }

    @PostConstruct
    private void postConstructor1(){
        System.out.println(" @PostConstruct 1");
    }

    @PostConstruct
    private void postConstructor2(){
        System.out.println(" @PostConstruct 2");
    }

    @PreDestroy
    private  void preDestroy(){
        System.out.println("preDestroy");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("afterPropertiesSet");
    }
}
